#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import time


def get_FileSize(filePath):
    fsize = os.path.getsize(filePath)
    fsize = fsize/float(1024*1024)
    return round(fsize, 2)


if __name__ == "__main__":
    st = time.time()
    file_dir = "../AY283G_iorecord_dataset/"
    # file_dir = "../db/dataset/"
    filenames = os.listdir(file_dir)

    n = len(filenames)
    i = 0
    for filename in filenames:
        if filename.split('.')[-1] == 'csv':
            raise ValueError
        i = i+1
        filepath = file_dir + filename
        if get_FileSize(filepath) < 900:
            os.remove(filepath)
            print("removing", filepath, "that is: ", i, "/", n)
